package com.kvest.multiframe_test;

import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.kvest.multiframe_test.fragment.ContentFragment;

/**
 * Created with IntelliJ IDEA.
 * User: Kvest
 * Date: 23.03.13
 * Time: 15:36
 * To change this template use File | Settings | File Templates.
 */
public class ContentActivity extends FragmentActivity {
    public static final String SELECTED_EXTRA = "selected";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.content_activity_layout);

        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            finish();
            return;
        }

        if (savedInstanceState == null) {
            int selected = getIntent().getIntExtra(SELECTED_EXTRA, 0);
            getSupportFragmentManager().beginTransaction().add(R.id.content_container, ContentFragment.newInstance(selected)).commit();
        }
    }
}
